#pragma once
#include <iostream>
#include <unordered_map>
#include <functional>
#include <initializer_list>
#include "Log.hpp"

typedef std::function<int(int, int)> fu_t;
void server_dispose(int real_socket, std::string& goal_ip, int goal_port);

class Task_add
{
    public: 
    Task_add(){}
    Task_add(int actual_socket, uint16_t port, std::string& ip)
    :_actual_socket(actual_socket), _port(port), _ip(ip)
    {}

    void operator()(const std::string& th_name)
    {
        server_dispose(_actual_socket, _ip, _port);
        delete this; // 我们载入的task*指向堆上，后面我们得单独释放
    }

    ~Task_add()
    {}
private:
    int _actual_socket;
    uint16_t _port;
    std::string _ip;
};
